import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

// 路由表
const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login')
  }, {
    path: '/',
    component: () => import('@/views/layout/index.vue'),
    children: [{
      path: '',
      component: () => import('@/views/home')
    }, {
      path: 'qa',
      component: () => import('@/views/qa')
    }, {
      path: 'video',
      component: () => import('@/views/video')
    }, {
      path: 'my',
      component: () => import('@/views/my')
    }]
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('@/views/Search/')
  }, {
    path: '/article/:articleId',
    props: true,
    name: 'article',
    component: () => import('@/views/article/')
  }
]

const router = new VueRouter({
  routes
})

export default router
